<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8" content="#">
    <title>销售订单页面</title>
    <!-- 引入CSS -->
    <link rel="stylesheet" type="text/css"
          href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/easyui/css/demo.css">
    <!-- 引入JS -->
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/easyui/themes/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript"
            src="/easyui/js/validateExtends.js"></script>
    <script type="text/javascript" src="/common/js/common.js"></script>
    <script type="text/javascript"
            src="/common/js/order.js"></script>
    <script type="text/javascript">
        var login_name;
        //DOM加载完成后执行的回调函数
        $(function () {
            //初始化日历控件
            $('#add_needTime').datebox({
                required: true,
                panelHeight: 'auto',
                formatter: function (date) {
                    var y = date.getFullYear();
                    var m = date.getMonth() + 1;
                    var d = date.getDate();
                    return y + '/' + m + '/' + d;
                },
                parser: function (s) {
                },
                editable: false
            });

            $.post("/pur-person/getPurGroupResults", {selected: false}, function (data) {
                $('#search-purGroup').combobox({
                    textField: 'content',
                    valueField: 'value',
                    panelHeight: 'auto',
                    data: data
                })
            });

            $.post("/system/getUserName", function (data) {
                login_name = data;
            })
            var table;
            //初始化datagrid
            $('#dataList').datagrid({
                iconCls: 'icon-more',//图标
                border: true,
                collapsible: false,//是否可折叠
                fit: true,
                method: "post",
                url: "/pur-order/getPurOrders?t" + new Date().getTime(),
                idField: 'id',
                singleSelect: false,//是否单选
                rownumbers: true,//行号
                pagination: true,//分页控件
                remoteSort: false,
                columns: [
                    [
                        {field: 'chk', checkbox: true, width: 50},
                        {field: 'id', title: 'ID', width: 35, sortable: true},
                        {
                            field: 'createTime', title: '下单时间', width: 180, sortable: true,
                            formatter: function (value, row, index) {
                                return transTime(value);
                            }
                        },
                        {
                            field: 'planTime', title: '计划交期', width: 180, sortable: true,
                            formatter: function (value, row, index) {
                                return transTime(value);
                            }
                        },
                        {field: 'purOrderId', title: '订单号', width: 125, sortable: true},
                        {field: 'purOrderRow', title: '行号', width: 40},
                        {field: 'purGroup', title: '采购组', width: 50, sortable: true},
                        {field: 'supplierCode', title: '供应商编码', width: 80, sortable: true},
                        {field: 'supplierName', title: '供应商全称', width: 180, sortable: true},
                        {field: 'thingCode', title: '物料编码', width: 100, sortable: true},
                        {field: 'thingName', title: '物料名称', width: 140, sortable: true},
                        {field: 'unit', title: '单位', width: 40},
                        {field: 'planCnt', title: '计划数量', width: 40},
                        {field: 'receiveCnt', title: '已收货', width: 60},
                        {field: 'noReceiveCnt', title: '未收货', width: 60},
                        {field: 'overtimeCnt', title: '逾期', width: 60},
                        {field: 'remark', title: '备注', width: 150},
                        {field: 'createPerson', title: '下单人', width: 80},
                        {field: 'receivePerson', title: '收货人', width: 80}
                    ]
                ],
                toolbar: "#toolbar"//工具栏
            });

            //设置分页控件
            var p = $('#dataList').datagrid('getPager');
            $(p).pagination({
                pageSize: 10,//设置每页显示的记录条数,默认为10
                pageList: [10, 20, 30, 50, 100],//设置每页记录的条数
                beforePageText: '第',
                afterPageText: '页    共 {pages} 页',
                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
            });
            //销售组名和销售名搜索按钮的监听事件(将其值返回给Controller)
            $("#search-btn").click(function () {
                $('#dataList').datagrid('load', {
                    purGroup: $('#search-purGroup').combobox('getValue'),//获取采购组名称
                    supplierName: $('#search-supplierName').textbox('getValue'),//获取供应商名字
                });
            });
        })
        ;
    </script>
</head>
<body>

<!-- 销售列表信息 -->
<table id="dataList" cellspacing="0" cellpadding="0"></table>

<div id="toolbar">
    <!-- 学生,班级名搜索域 -->
    <div style="margin-left: 10px;">
        <!-- 商品名称搜索框 -->
        <a href="javascript:" class="easyui-linkbutton"
           data-options="iconCls:'icon-user-student',plain:true">采购组</a>
        <select id="search-purGroup" class="easyui-combobox" style="width: 250px">
        </select>

        <a href="javascript:" class="easyui-linkbutton"
           data-options="iconCls:'icon-user-student',plain:true">供应商全称</a>
        <input id="search-supplierName" class="easyui-textbox"/>

        <!-- 搜索按钮 -->
        <a id="search-btn" href="javascript:" class="easyui-linkbutton"
           data-options="iconCls:'icon-search',plain:true">搜索</a>
    </div>


</div>
<!--更新商品-->
<div id="updateDialog" style="padding: 20px 0 0 65px">
    <!-- 学生信息表单 -->
    <form id="updateForm" method="post" action="#">
        <!-- 获取被修改信息的学生id -->
        <input type="hidden" id="update_id" name="id"/>
        <table id="updateTable" style="border-collapse:separate; border-spacing:0 3px;" cellpadding="6">

            <tr>
                <td>供应链确认时间</td>
                <td colspan="4"><input id="update_planTime" style="width: 200px; height: 30px;"
                                       class="easyui-textbox"
                                       type="text" />
                </td>
            </tr>
        </table>
    </form>
</div>

</body>
</html>